#include <iostream>

using namespace std;

int main()
{
    char a[100];
    int n,m;
    std::cout<<"n= ";
    std::cin>>n;
    for (int i=1;i<=n;i++)
    {
        std::cout<<"a["<<i<<"=]";
        std::cin>>a[i];
    }
    std::cout<<"m= ";
    std::cin>>m;
    for (int i=1;i<=m;i++)
    {
        char aux=a[i];
        a[i]=a[n-i+1];
        a[n-i+1]=aux;
    }
    for (int i=1;i<=n;i++)
    {
        std::cout<<a[i];
    }
    return 0;
}
